<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<h:form id="formAdminData" prependId="false"  >
		<script type="text/javascript" src="#{request.contextPath}/css/script/script.js"/>

		<h:panelGrid  columns="2" style="width:50;min-height:90%;height:90%"  columnClasses="top-align,top-align"   >   
			<h:column >
				<h:panelGrid columns="2" cellpadding="2" > 
		            <h:outputLabel value="#{msgs.Email} :" for="adminEmail" />
		            <p:inputText id="adminEmail" value="#{adminBean.admin.user.email}" maxlength ="50" size="50" required="true" requiredMessage="#{msgs.EmailObligatory}"/>
		            			
					<h:outputLabel value="#{msgs.Password} :"	for="adminPassword" />
					<p:password id="adminPassword" autocomplete="off"	redisplay="true"
						value="#{ adminBean.admin.user.password}" maxlength="15"	size="15" required="true" requiredMessage="#{msgs.PasswordObligatory}"/>
		
		            <h:outputLabel value="#{msgs.FirstName} :" for="adminFirstName"  />
		            <p:inputText id="adminFirstName"    value="#{adminBean.admin.firstName}" maxlength ="20" size="20" required="true"  requiredMessage="#{msgs.AdminNameObligatory}"/>

		            <h:outputLabel value="#{msgs.LastName} :" for="adminLastName"  />
		            <p:inputText id="adminLastName"    value="#{adminBean.admin.lastName}" maxlength ="40" size="40" />


		            <h:outputLabel value="#{msgs.Phone} :" for="adminPhone" styleClass="sp_celphones" />
		            <p:inputText id="adminPhone" 	value="#{adminBean.admin.user.phone}" maxlength ="22" size="22" styleClass="sp_celphones"  />
		

	    	        <h:outputLabel value="#{msgs.DefaultTheme} :" for="adminTheme" />
					<p:selectOneMenu id="adminTheme" value="#{adminBean.admin.theme}" converter="#{themeConverter}" validator="#{themeValidator.validate}" var="t" style="width:165px;text-align:left">  
                        <f:selectItems value="#{adminBean.advancedThemes}" var="theme" itemLabel="#{theme.name}" itemValue="#{theme}"  />
			            <p:column>
			                <p:graphicImage value="/css/images/themes/#{t.image}"/>
			            </p:column>
			            <p:column>
			                #{t.name}
			            </p:column>
			        </p:selectOneMenu>
	
		            <h:outputText value="#{msgs.Status} :" />
		            <p:selectOneRadio value="#{adminBean.admin.user.active}" >
		                <f:selectItem itemLabel="#{msgs.Active}"  	itemValue="true"   />
		                <f:selectItem itemLabel="#{msgs.Inactive}"	itemValue="false" />
		            </p:selectOneRadio>
	
					<h:outputLabel 	value="#{msgs.CreatedAt} :"		for="adminCreatedAt" rendered="#{adminBean.admin.id != null}"  />
					<p:inputText  	id="adminCreatedAt" 	value="#{adminBean.admin.user.createdAt}" disabled="true" rendered="#{adminBean.admin.id != null}"   >
						<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" />
					</p:inputText>
	
					<h:outputLabel 	value="#{msgs.ChangedAt} :"		for="adminChangedAt" rendered="#{adminBean.admin.id != null}"  />
					<p:inputText  	id="adminChangedAt" 	value="#{adminBean.admin.user.lastChange}" disabled="true" rendered="#{adminBean.admin.id != null}"  >
						<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" />
					</p:inputText>
				</h:panelGrid>
			</h:column>
			<h:column>
				<div align="center" style="width:100%">
					<p:commandLink oncomplete="wdlgupload.show();" process="@this"  >
						<p:graphicImage  id="photoAdmin"  title="#{msgs.Photo} 120px x 100px"  cache="false" 	
							url="#{adminBean.admin.photo.folder}#{adminBean.admin.photo.location}" height="120px" width="100px" style="border:1px solid;"/>
							<f:setPropertyActionListener  value="#{3}" target="#{adminBean.uploadType}" />
					</p:commandLink>
				</div>
			</h:column>
		</h:panelGrid>	
		<div align="left"   >
			<p:commandButton  value="#{msgs.Save}"		action="#{adminBean.saveAdmin}"		
				ajax="true"	update=":growl,:content,:listAdminForm"		icon="ui-icon-disk"	rendered="#{adminBean.admin.id != null}" />
			<p:commandButton  value="#{msgs.Create}"	action="#{adminBean.createAdmin}"	
				ajax="true"	update=":growl,:content,:listAdminForm"		icon="ui-icon-document"	rendered="#{adminBean.admin.id == null}" />
			<p:spacer width="50px"/>	
			<p:commandButton  value="#{msgs.Cancel}"	action="#{adminBean.cancelChange}"	icon="ui-icon-cancel"/>
		</div>
	</h:form>
</html>